<?php

namespace app\api\controller;


class Image extends ApiBase {
    public function save() {
        $url  = model('Images')->uploadToQiniu();
        $data = input('post.');
        if ($url) {
            $data['url']  = $url;
            $data['from'] = config('code.from_online');
            model('Images')->add($data);
            return show(0, 'OK');
        }
        return show(1, '上传失败');
    }

    public function delete($id) {
        $result = model('Images')->deleteImg($id);
        return show(0, '', $result);
    }
}